﻿using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;
using MDIDemo.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DevMy.PublicSetUp
{
    public class Class_RadioGroup
    {
        public void SetRadioGroup(RadioGroup radioGroup, Class_Dictionary[] class_Dictionaries,int Columns)
        {
            radioGroup.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            radioGroup.Properties.Appearance.Options.UseFont = true;
            radioGroup.Properties.Columns = Columns;
            if (class_Dictionaries != null)
            {
                radioGroup.Properties.Items.Clear();
                int index = 0;
                foreach (Class_Dictionary item in class_Dictionaries)
                {
                    radioGroup.Properties.Items.Add(new RadioGroupItem(null, item.id));
                    if (item.defaultSelect)
                        radioGroup.SelectedIndex = index;
                    index++;
                }
            }
            else
            {
                if (radioGroup.Properties.Items.Count > 0)
                    radioGroup.SelectedIndex = 0;
            }
        }

    }
}
